package com.onec.service.trade.service.impl;

import com.onec.service.trade.dao.BankInfoRepository;
import com.onec.service.trade.entity.BankInfo;
import com.onec.service.trade.service.BankInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Optional;

/**
 * 获取银行卡信息：
 * @author onec
 */
@Service
public class BankInfoServiceImpl implements BankInfoService {


    @Autowired
    private BankInfoRepository bankInfoRepository;

    @Override
    public BankInfo getBankInfo(String bankCode) {
        return bankInfoRepository.findByBankCode(bankCode);
    }

    @Override
    public BankInfo getAvailableBankInfo(String bankCode) {

        BankInfo bankInfo = this.getBankInfo(bankCode);
        if (Optional.ofNullable(bankInfo).isEmpty()) {

        }
        return bankInfo;
    }
}
